<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>1231313</li>
        <li>112313</li>
        <li>1313131</li>
        <li>13132134</li>
        <li>12414124</li>
        <li>14214214124</li>
        <li>14141414</li>
        <li>142546363</li>
        <li>3643636</li>
        <li>363636</li>
    </ul>
    hahahahhahahahaa
    <script>
        var ul = document.querySelector('ul');
        var lis = ul.children;
        ul.addEventListener('click', function (e) {
            // alert('事件委托：不是给每个子节点单独设定事件监听器，而是给父节点设置事件监听，通过冒泡来影响每个子节点。');
            for (var i = 0; i < lis.length; i++) {
                lis[i].style.backgroundColor = '';
            }
            e.target.style.backgroundColor = 'skyblue';
        })

    </script>
</body>

</html>